package com.zsk.shop.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zsk.shop.entity.GlobalException;
import com.zsk.shop.mapper.GlobalExceptionMapper;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author ljh
 * @create 2021/8/30 14:07
 */
@Service
public class GlobalExceptionService extends ServiceImpl<GlobalExceptionMapper, GlobalException> {

    public void add(Exception e, Class<? extends Exception> clazz) {
        GlobalException ylException = GlobalException.builder()
                .exceptionType(clazz.getName()).e(e.toString()).createTime(new Date()).build();
        this.save(ylException);
    }
}
